package com.ljx.funchat.sensitive.algorithm;

import java.util.HashMap;
import java.util.Map;

/**
 * Tire树结点
 */
public class TrieNode {
    /**
     * 子节点
     */
    private Map<Character, TrieNode> nextNodes = new HashMap<>();

    public void addNext(Character key, TrieNode trieNode){
        nextNodes.put(key, trieNode);
    }

    public TrieNode getNext(Character key){
        return nextNodes.get(key);
    }

    public boolean isLastCharacter(){
        return nextNodes.isEmpty();
    }

}